//
// Created by 谢哲 on 2021/5/16.
//

#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main() {
    int n;
    cin >> n;

    vector<int> kdata(100009, 0);
    queue<pair<int, int>> qdata;
    vector<vector<int>> vdata;

    int cnt = 0;
    for (int i=0; i<n; ++i) {
        int t, k;
        cin >> t >> k;
        qdata.push(make_pair(i, t));

        vector<int> cur_data;
        for (int j=0; j<k; ++j) {
            int a;
            cin >> a;
            cur_data.emplace_back(a);
            if (kdata[a] == 0) {
                ++cnt;
            }
            kdata[a]++;
        }
        vdata.emplace_back(cur_data);

        while (!qdata.empty() && qdata.front().second <= t - 86400) {
            auto index = qdata.front().first;
            qdata.pop();
            for (auto p: vdata[index]) {
                kdata[p]--;
                if (kdata[p] == 0) {
                    --cnt;
                }
            }
        }

        cout << cnt << "\n";
    }

    return 0;
}